package com.example.javatwo.controller.xs.dh;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.javatwo.pojo.xs.dh.Kehu;
import com.example.javatwo.service.xs.dh.IKehuBiz;
import com.example.javatwo.util.PageBead;

@Controller
public class KehuAction {

	@Autowired
	private IKehuBiz biz;

	public IKehuBiz getBiz() {
		return biz;
	}

	public void setBiz(IKehuBiz biz) {
		this.biz = biz;
	}

	@RequestMapping("/dh/kehu")
	public String findloadkehu() {
		return "xs/dh/DHkehu";
	}

	@RequestMapping("/dh/kehusave")
	@ResponseBody
	public String saveKehu(@RequestBody Kehu p) {
		if(biz.saveKehu(p)==1){
			return "不能更新已审核的单据";
		}else{
			return "ok";
		}	
	}

	@RequestMapping("/loadPageKehu")
	@ResponseBody
	public PageBead findLoadPage(Integer pageNum) {
		return biz.findPage(pageNum);
	}

	@RequestMapping("/dh/loadPage")
	@ResponseBody
	public Kehu findIdresult(String id) {
		return biz.findKehu(id);
	}

	@RequestMapping("/dh/delKehu")
	@ResponseBody
	public String delKehu(String id) {
		biz.delKehu(id);
		return "ok";
	}
	
	@RequestMapping("/dh/shenhe")
	@ResponseBody
	public String clickKehu(String id) {
		if(biz.updateKehu(id)==1){
			return "已经审核，不能再次审核！";
		}else{
			return "ok";
		}
	}
	
	

}
